<template>
  <div>
    {{ message }}
    <van-button type="primary" size="small" @click="changeMessage">方式一(修改)</van-button>
    <van-button type="primary" size="small" @click="changeMessageC">方式二(修改)</van-button>
  </div>
</template>

<script>
import {
  ref
} from 'vue';
export default {
  name: "ref",
  setup() {
    let message = ref("你好");

    const changeMessage = () => { // 方式一
      message.value = "hello";
    }
  
    return {
      message,
      changeMessage
    }
  },
  methods: {
    changeMessageC() {  // 方式二
      this.message = "helloC"
    }
  }
}
</script>